package com.datam.utils;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.util.ArrayList;
import java.util.List;

public class Test {
	
	public static void main(String[] args) {
		 File file = new File("D:\\EclipseWorkSpace\\"
		 		+ "data-monitor\\data-monitor\\src\\main\\java\\com\\datam\\query");
		 List<String> files = new ArrayList<String>();
	        File[] tempList = file.listFiles();

	        for (int i = 0; i < tempList.length; i++) {
	        	if(i == 1){
	        		if (tempList[i].isFile()) {
		                load(tempList[i]);
		            }
		            if (tempList[i].isDirectory()) {
		                //这里就不递归了，
		            }
	        	}
	            
	        }
	}

	private static void load(File file) {
		FileReader fr;
		try {
			fr = new FileReader(file);
			BufferedReader bf = new BufferedReader(fr);
			String str;
			// 按行读取字符串
			while ((str = bf.readLine()) != null) {
				if(str.contains("String")){
					String[] s = str.split("String");
					System.out.println(s[0]+" String "+s[1].toUpperCase());
				}else if(str.contains("Long")){
					String[] s = str.split("Long");
					System.out.println(s[0]+" Long "+s[1].toUpperCase());
				}else{
					System.out.println(str);
				}
				
			}
			bf.close();
			fr.close();
		} catch (Exception e) {
			// TODO 自动生成的 catch 块
			e.printStackTrace();
		}
		
	}

}
